package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-17
 * Time: 12:50
 */
public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args){
    // Shape shape = new Shape();抽象类不能实例化
    Shape shape = new Rect();//可以向上转型
    //匿名对象
    Rect rect = new Rect();
    drawMap(rect);
    drawMap(new Rect());
    rect.draw();
    new Rect().draw();
    }
}
